/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aiaudio.processing.split.mappers;

import aiaudio.database.tables.RatingsMatrixTable;
import java.io.IOException;
import java.util.Map;
import java.util.NavigableMap;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableMapper;
import org.apache.hadoop.io.BooleanWritable;

/**
 *
 * @author nastya
 */
public class DataSetArtistListMapper extends TableMapper<ImmutableBytesWritable, BooleanWritable> {

    @Override
    protected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException, InterruptedException {
        NavigableMap<byte[], byte[]> familyMap = RatingsMatrixTable.getUsers(value);
        for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
            context.write(new ImmutableBytesWritable(entry.getKey()), new BooleanWritable(true));
        }

    }
}
